<?php
require_once 'base.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Epigram</title>
</head>

<?php
$where = ' ';
$choseType = fget('type');
if (!empty($choseType)){
	$where = ' WHERE type=' . $choseType;
}

$sql = "SELECT id, type, content, source, add_time FROM epigram" . $where . " ORDER BY id DESC";

$resource = @mysql_query($sql);

if ($rs = mysql_fetch_array($resource, MYSQL_ASSOC)){
	$number = 1;
	do{
		echo '<br /><div>' . $number++ . ' [' . $typeArr[$rs['type']] . '] ' . stripslashes($rs['content']) . '</div>';
	}while($rs = mysql_fetch_array($resource, MYSQL_ASSOC));
}else{
	die('No message!');
}

mysql_close($conn);
?>

</body>
</html>